package BookStore.dao;

import BookStore.model.User_psw;
import BookStore.util.VDbUtil;

import javax.swing.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import BookStore.model.User_psw;

public class User_pDao {
     private User_psw user_psw;

     public User_pDao(User_psw temp_p) { this.user_psw = temp_p; }

    public void alt_psw() throws Exception {
         Connection con_2_2 = VDbUtil.getCon_2_2();
         String sql_psw = "update JDBC set psw = '" + user_psw.getPsw() + "' where name = '" + user_psw.getName() + "'";
         PreparedStatement ps_psw = con_2_2.prepareStatement(sql_psw);
         ResultSet alt_p = ps_psw.executeQuery();
         JOptionPane.showMessageDialog(null,"密码修改成功");

         con_2_2.close();
         ps_psw.close();
    }
}
